package com.zzc.repository;

import com.zzc.domain.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface AdminRep extends JpaRepository<Admin,Integer> , JpaSpecificationExecutor<Admin> {

    Admin findByEmail(String email);

    @Modifying
    @Transactional
    @Query(value = "update admin set pwd = ?1 where email = ?2 ",nativeQuery = true)
    void updateByEmail(String pwd,String email);
}
